import random

# 定义生肖列表
zodiac_signs = ["鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"]

# 定义生肖对冲关系
opposites = {
    "鼠": "马",
    "牛": "羊",
    "虎": "猴",
    "兔": "鸡",
    "龙": "狗",
    "蛇": "猪",
    "马": "鼠",
    "羊": "牛",
    "猴": "虎",
    "鸡": "兔",
    "狗": "龙",
    "猪": "蛇"
}


# 显示生肖列表
def show_zodiac_signs():
    print("生肖列表如下：")
    for i, sign in enumerate(zodiac_signs, start=1):
        print(f"{i}. {sign}")


# 主游戏函数
def zodiac_opposite_game():
    print("欢迎来到生肖对冲游戏！")
    show_zodiac_signs()

    while True:
        try:
            choice = int(input("请选择一个生肖的序号 (1 - 12): "))
            if 1 <= choice <= 12:
                player_sign = zodiac_signs[choice - 1]
                print(f"你选择的生肖是：{player_sign}")
                break
            else:
                print("输入的序号无效，请输入 1 到 12 之间的数字。")
        except ValueError:
            print("输入无效，请输入一个有效的数字。")

    # 程序随机选择一个生肖
    computer_sign = random.choice(zodiac_signs)
    print(f"程序选择的生肖是：{computer_sign}")

    # 判断是否对冲
    if opposites[player_sign] == computer_sign:
        print(f"哇！{player_sign} 和 {computer_sign} 对冲啦！")
    else:
        print(f"{player_sign} 和 {computer_sign} 没有对冲。")


if __name__ == "__main__":
    zodiac_opposite_game()